package com.lin.controller;


import com.lin.commons.Result;
import com.lin.entity.UserExtraCost;
import com.lin.service.UserExtraCostService;
import com.lin.vo.DataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 林伟鸿
 * @since 2021-11-24
 */
@RestController
//@RequestMapping()
@CrossOrigin
public class UserExtraCostController {


    @Autowired
    UserExtraCostService userExtraCostService;

    @GetMapping("/userExtraCost")
    public DataVO<UserExtraCost> getUserExtraCost() {
        return null;
    }

    @GetMapping("/returnCar")
    public Result returnCar(@RequestParam("orderSerial") String orderSerial, @RequestParam("lastDay") String lastDay) {
        int returnResult = userExtraCostService.returnCar(orderSerial, lastDay);
        if (returnResult == 1) {
            return Result.success("申请成功");
        } else if (returnResult == 3) {
            return Result.failure("请耐心等待处理");
        } else {
            return Result.failure("申请失败");
        }
    }


}

